<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>欢迎页面</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
</head>

<body>
<p>
    <@shiro.guest>
        您当前是游客，<a href="/login">登录</a>
    </@shiro.guest>
</p>

<p>
    <@shiro.user>
        欢迎[${user.realName }]登录，<a href="/logout">退出登录</a>
    </@shiro.user>
</p>

<p>
    <@shiro.hasPermission name="user:add">
        <a href="/user">【user】权限页面</a>
    </@shiro.hasPermission>
</p>


<script>
    // 想要获取的cook键值
    var cookie_name = "FORM_WEBSID";
    // 调用
    var cookie_value = getCookie(cookie_name);
    alert(cookie_value);
    function getCookie(cookie_name) {
        var allcookies = document.cookie;
        //索引长度，开始索引的位置
        var cookie_pos = allcookies.indexOf(cookie_name);

        // 如果找到了索引，就代表cookie存在,否则不存在
        if (cookie_pos != -1) {
            cookie_pos = cookie_pos + cookie_name.length + 1;
            //计算取cookie值得结束索引
            var cookie_end = allcookies.indexOf(";", cookie_pos);
            if (cookie_end == -1) {
                cookie_end = allcookies.length;

            }
            var value = unescape(allcookies.substring(cookie_pos, cookie_end));
        }
        return value;
    }

</script>

</body>
</html>
